﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WaterBill.DAL;
using WaterBill.DTO;

namespace WaterBill.BUS
{
    class BUS_Charges : DAL_Charges
    {
        DataTable dtCh;
        //Lay danh sach tat ca cac thang
        public DataTable BUS_Charges_GetAll()
        {
            dtCh = new DataTable();
            try
            {
                dtCh = DAL_Charges_GetAll();
            }
            catch
            {
            }
            return dtCh;
        }

        //Lay danh sach cac thang dua vao id
        public DataTable BUS_Charges_GetById(int ChargeId)
        {
            dtCh = new DataTable();
            try
            {
                dtCh = DAL_Charges_GetById(ChargeId);
            }
            catch
            {
            }
            return dtCh;
        }

        //lay du lieu thang dua vao id lon nhat
        public DataTable BUS_Charge_GetByMaxId()
        {
            dtCh = new DataTable();
            try
            {
                dtCh = DAL_Charges_GetByMaxId();
            }
            catch 
            {
            }
            return dtCh;
        }

        //Them mot ap moi
        public Boolean BUS_Charges_Insert(DTO_Charges obj)
        {
            try
            {
                if (DAL_Charges_Insert(obj))
                {
                    return true;
                }
            }
            catch
            {
            }
            return false;
        }

        //Sua ap
        public Boolean BUS_Charges_Update(DTO_Charges obj)
        {
            try
            {
                if (DAL_Charges_Update(obj))
                {
                    return true;
                }
            }
            catch
            {
            }
            return false;
        }
        //lay danh sach thang (group by)
        public DataTable BUS_Charge_GetAllMonth()
        {
            dtCh = new DataTable();
            try
            {
                dtCh = DAL_Charge_GetAllMonth();
            }
            catch
            {
            }
            return dtCh;
        }
        //lay danh sach nam (group by)
        public DataTable BUS_Charge_GetAllYear()
        {
            dtCh = new DataTable();
            try
            {
                dtCh = DAL_Charge_GetAllYear();
            }
            catch
            {
            }
            return dtCh;
        }
    }
}
